{% load static %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>生成试卷</title>
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <!-- Bootstrap 核心CSS文件 -->
    <link href="{% static 'login/css/bootstrap.min.css' %}" rel="stylesheet">
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="justified-nav.css" rel="stylesheet">
    <style type="text/css">
      body{
        background: url("{% static 'login/image/6786.jpg' %}") repeat-y;
        background-size: 100%;
        background-color: white;
        color: #337ab7;
        }
        /*.form-signin{background: rgba(255,255,255,0);width:320px;margin:120px auto;}*/
        /*阴影*/
        .fa{display: inline-block;top: 27px;left: 6px;position: relative;color: #ccc;}
        input[type="text"],input[type="password"]{padding-left:26px;}
        #checkbox{padding-left:21px;}
        
        .form-signin-heading{
            text-align: center;
            color: #337ab7;
        }
        .main_box{
        	margin-top: 30px;
        }
        .tabbable{
            background: rgba(255,255,255,0.7);
        }
        .footer{
            background: rgba(255,255,255,0.7);
            position: fixed;
            left: 460px;
            bottom: 6px;
        }
        .footer .foot{
            margin: 0 auto;
        }
        .the_box{
            margin: 30px 0 0;
        }
  </style>

</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-md-2">
            </div>        
            <div class="col-md-8 tabbable main_box" id="tabs-142121">
                <div class="masthead">
                    {%if zhuce%}
                    <form action="{% url 'face:test' id%}" method="post">
                        <button class="form-signin-heading" type="submit">人脸注册</button>
                    </form>
                    {%endif%}
                    <h2 class="form-signin-heading">北京网络职业学院考试系统</h2>
                    <h3 class="form-signin-heading">敬爱的{{teacher_name}}老师，请选择试卷或生成新的试卷</h3>
                </div> 
                <div class="tabbable the_box" id="tabs-142726">
                    <ul class="nav nav-tabs">
                        <li class="active">
                            <a href="#panel-666" data-toggle="tab" contenteditable="false" class="glyphicon glyphicon-expand">查看已生成的试卷
                            </a>
                        </li>
                        <li class="">
                            <a href="#panel-888" data-toggle="tab" contenteditable="false" class="
                            glyphicon glyphicon-circle-arrow-right">生成新的试卷
                            </a>
                        </li>
                        <li class="pull-right">
                            <a href="{% url 'login:login' %}" class="glyphicon glyphicon-user">返回登录界面
                            </a>
                        </li>
                        <li class="pull-right">
                            <a href="{% url 'paper:batch' %}" class="pull-right glyphicon glyphicon-pencil">点击前往批卷页面 
                            </a>
                        </li>
                        
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active" id="panel-666">
                            <div class="tabbable" id="tabs-142739">
                            <i class="fa fa-user fa-lg"></i>
                            
                            
                            <h4 class="glyphicon glyphicon-leaf">点击试卷名字查看试卷详细内容</h4>
                            <h4 class="glyphicon glyphicon-exclamation-sign pull-right" style="display: inline-block;color: #d9534f;">注意：默认试卷不可直接删除</h4>
                            <h4 class="glyphicon glyphicon-ok" style="color: #337ab7;">当前默认试卷为：{{the_paper}}</h4>
                            
                                {% if error %}
                                <h4 style="color: red;">{{error}}</h4>
                                {% endif %} 
                                <div class="panel-group" id="panel-307253">
                                    {% for paper,info in paper_dict.items %}
                                        <div class="panel panel-default">
                                        <div class="panel-heading">
                                        <a class="panel-title collapsed" data-toggle="collapse" data-parent="#panel-307253" href="#paper{{forloop.counter}}" contenteditable="false">{{paper}}</a>
                                             
                                        <form class="form-signin pull-right" action="{% url 'paper:paper_remove' %}" method="post">
                                                {% csrf_token %}
                                            <label for="inputRemove" class="sr-only">传递试卷：</label>
                                            <input type="text" name="删除试卷"  value="{{paper}}" id="inputRemove" class="form-control"  required style="display: none;">
                                            <button class="btn btn-danger btn-xs" type="submit">删除此试卷</button>
                                        </form>                             
                                  
                                        <form class="form-signin pull-right" action="{% url 'paper:paper_show' %}" method="post">
                                                {% csrf_token %}
                                            <label for="inputPaper" class="sr-only">传递试卷：</label>
                                            <input type="text" name="默认试卷"  value="{{paper}}" id="inputPaper" class="form-control"  required style="display: none;">
                                            <button class="btn btn-info btn-xs" type="submit">设为默认试卷</button>
                                        </form>          

                                        </div>
                                        <div id="paper{{forloop.counter}}" class="panel-collapse collapse" style="height: auto;">
                                        <div class="panel-body" contenteditable="false">
                                        {% if info.单选题 %}
                                          <!--这里放置单选题面板-->
                                          <div class="panel panel-primary">
                                            <div class="panel-heading">
                                              <h3 class="panel-title"> 单选题(单题分值:{{info.单选题.1}})</h3>
                                            </div>
                                            <div class="panel-body">
                                              {% for question in info.单选题.2 %}
                                              <h3>{{forloop.counter}}、{{question.question_text}}</h3>
                                              <ol type="A">
                                              {% for choice in question.choice_set.all %}
                                                <li>
                                                   {{choice.choice_text}} 
                                                </li>
                                              {% endfor %}
                                              </ol>
                                            {% endfor %}
                                          </div>    
                                        </div>
                                        <!--/单选题面板结束-->
                                        {%endif%}
                                         <!--多选题面板-->
                                        {% if info.多选题 %}
                                        <div class="panel panel-success">
                                            <div class="panel-heading">
                                              <h3 class="panel-title"> 多选题(单题分值:{{info.多选题.1}})</h3>
                                            </div>
                                            <div class="panel-body">
                                              <h3>这里放置题干，直接更改文字即可</h3>
                                              <div class="checkbox">
                                                <label>
                                                  <input type="checkbox" value="">
                                                  A.这里放置选项文字，直接更改即可。
                                                </label>
                                            </div>
                                            <div class="checkbox">
                                                <label>
                                                  <input type="checkbox" value="">
                                                  B.这里放置选项文字，直接更改即可。
                                                </label>
                                            </div>  
                                        </div>
                                        {% endif %}
                                        <!--/多选题面板结束-->
                                        <!--填空题面板部分-->
                                        {% if info.填空题 %}
                                        <div class="panel panel-info">
                                            <div class="panel-heading">
                                              <h3 class="panel-title"> 填空题(单题分值:{{info.填空题.1}})</h3>
                                            </div>
                                            <div class="panel-body table-responsive">
                                              <table class="table table-hover">
                                                {% for question in info.填空题.2 %}
                                                <tr>
                                                  <td>{{forloop.counter}}、{{question.question_text}}</td>
                                                  {% endfor %}
                                                </tr>
                                              </table>
                                            </div>
                                        </div>
                                        {% endif %}
                                        <!--/填空题面板结束-->
                                        <!--判断题面板开始-->
                                        {% if info.判断题 %}
                                        <div class="panel panel-warning">
                                            <div class="panel-heading">
                                              <h3 class="panel-title"> 判断题(单题分值:{{info.判断题.1}})</h3>
                                            </div>
                                            <div class="panel-body">
                                              {% for question in info.判断题.2 %}
                                              <div class="row">
                                                
                                                <div class="col-sm-12">
                                                  <p>{{forloop.counter}}、{{question.question_text}}</p>         
                                                </div>  
                                              </div>
                                              {% endfor %}    
                                            </div>
                                        </div>
                                        {% endif %}
                                        <!--/判断题面板结束-->
                                        <!--简答题面板-->
                                        {% if info.简答题 %}
                                          <div class="panel panel-danger">
                                            <div class="panel-heading">
                                              <h3 class="panel-title"> 简答题(单题分值:{{info.简答题.1}})</h3>
                                            </div>
                                            <div class="panel-body">
                                              {% for question in info.简答题.2 %}
                                              <div class="row">
                                                <div class="col-sm-10 col-sm-offset-1">
                                                  <h3>{{forloop.counter}}、{{question.question_text}}</h3>
                                                </div>      
                                              </div>
                                              {% endfor %}
                                            </div>
                                        
                                        </div>
                                        {% endif %}
                                        <!--/简答题面板结束-->

                                         </div>
                                    </div>
                                </div>
                                {% endfor %}

                                </div>
                            </div>
                        </div>
        
                        <div class="tab-pane" id="panel-888">
                            <i class="fa fa-user fa-lg"></i>

                            <div class="tabbable" id="tabs-142713">
                                <ul class="nav nav-tabs">
                                    {% for question_obj,question_num in type_dict.items %} 
                                        {% if forloop.counter == 1 %}
                                        <li class="active">
                                        {% else %}
                                        <li class="">
                                        {% endif %}
                                        <a href="#question_obj{{forloop.counter}}" data-toggle="tab" contenteditable="false">{{question_obj.question_type}}
                                        </a>             
                                        </li>
                                    {% endfor %}
                                    <li class="pull-right">
                                        <a data-toggle="tab" contenteditable="false" style="pointer-events: none;color: #0089ff">设置好所有题型才可生成试卷</a>
                                    </li>
                                </ul>
                    
                        <form class="form-signin" action="{% url 'paper:index_yunsuan' %}" method="post">
                            {% csrf_token %}
                            <div class="tab-content">
                                {% for question_obj,question_num in type_dict.items %}
                                    {% if forloop.counter == 1 %}
                                    <div class="tab-pane active" id="question_obj{{forloop.counter}}">

                                    {% else %}
                                    <div class="tab-pane" id="question_obj{{forloop.counter}}">

                                    {% endif %}
                                    
                                    <h4>温馨提示：题库共有 {{question_num}} 道此题型</h4>
                                    <i class="fa fa-user fa-lg"></i>
                                    <label for="inputNum">请输入要出几道题：</label>
                                    <input type="text" name="{{question_obj.question_type}}" id="inputNum" class="form-control" placeholder="题数" required autofocus>
                                    <i class="fa fa-lock fa-lg"></i>
                                    <label for="inputScore">请输入该题型分值：</label>
                                    <input type="text" name="{{question_obj.question_type}}" id="inputScore" class="form-control" placeholder="分数" required>
                                </div> 
                                {% endfor %}

                                <i class="fa fa-user fa-lg"></i>    
                                <label for="paper_name">请输入您的试卷名：</label>
                                <input type="text" name="paper_name" id="paper_name" class="form-control" placeholder="试卷名字只需输入一次即可">
                                <i class="fa fa-user fa-lg"></i>
                            <button class="btn btn-lg btn-primary btn-block" type="submit">点击生成试卷</button>
                        </form>

                    </div>

                </div>

            </div>
        </div>

    </div>
                  
    </div> 
    <div class="col-md-2">
    </div> 
</div>
        <footer class="footer">
        <p class="foot">&copy; 2018 北京网络职业学院考试系统Company, Inc.</p>
        </footer>
    </div>
<script type="text/javascript" src="{% static 'login/js/jquery-3.3.1.min.js' %}"></script>
<!-- Bootstrap部分： -->
<script type="text/javascript" src="{% static 'login/js/bootstrap.min.js' %}"></script>
</body>
</html>